package com.todo.event.activity.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author azhebuxing
 * @date 2025/1/8 17:34
 * @description
 */
@Getter
@AllArgsConstructor
public enum EventActivityExecuteRewardEnum {
    COUPON(1, "COUPON", "优惠券"),
    BONUS(2, "BONUS", "积分"),
    GROWTH(3, "GROWTH", "成长值"),


    COMPARE(99, "COMPARE", "空白对照组"),
    ;

    private static Map<Integer, EventActivityExecuteRewardEnum> typeMap = Arrays
            .stream(EventActivityExecuteRewardEnum.values())
            .collect(Collectors.toMap(EventActivityExecuteRewardEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static EventActivityExecuteRewardEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
